void px()
{
    int i, j, where, incomeCount, expenseCount, totalCount, temp;
    int tempYear, tempMonth, tempDay, tempHour, tempMinute;
    char tempThing[101];
    incomeCount = 0;
    expenseCount = 0;
    tempDay = 0;
    tempHour = 0;
    tempMinute = 0;
    tempMonth = 0;
    tempYear = 0;

    for (i = 0; i < 400; i++)
        if (SHOURU_XINXI[i].bianhao1 != 0)
            incomeCount++;
    for (i = 0; i < 400; i++)
        if (ZHICHU_XINXI[i].bianhao2 != 0)
            expenseCount++;
    totalCount = incomeCount + expenseCount;

    for (j = incomeCount - 1; j >= 1; j--)
    {
        tempYear = SHOURU_XINXI[0].year1;
        tempMonth = SHOURU_XINXI[0].month1;
        tempDay = SHOURU_XINXI[0].ri1;
        tempHour = SHOURU_XINXI[0].hour1;
        tempMinute = SHOURU_XINXI[0].minute1;
        where = 0;
        for (i = 1; i <= j; i++)
        {
            if (tempYear < SHOURU_XINXI[i].year1 ||
                (tempYear == SHOURU_XINXI[i].year1 && tempMonth < SHOURU_XINXI[i].month1) ||
                (tempYear == SHOURU_XINXI[i].year1 && tempMonth == SHOURU_XINXI[i].month1 && tempDay < SHOURU_XINXI[i].ri1) ||
                (tempYear == SHOURU_XINXI[i].year1 && tempMonth == SHOURU_XINXI[i].month1 && tempDay == SHOURU_XINXI[i].ri1 && tempHour < SHOURU_XINXI[i].hour1) ||
                (tempYear == SHOURU_XINXI[i].year1 && tempMonth == SHOURU_XINXI[i].month1 && tempDay == SHOURU_XINXI[i].ri1 && tempHour == SHOURU_XINXI[i].hour1 && tempMinute < SHOURU_XINXI[i].minute1))
            {
                tempYear = SHOURU_XINXI[i].year1;
                tempMonth = SHOURU_XINXI[i].month1;
                tempDay = SHOURU_XINXI[i].ri1;
                tempHour = SHOURU_XINXI[i].hour1;
                tempMinute = SHOURU_XINXI[i].minute1;
                where = i;
            }
        }
        temp = SHOURU_XINXI[j].year1;
        SHOURU_XINXI[j].year1 = SHOURU_XINXI[where].year1;
        SHOURU_XINXI[where].year1 = temp;

        temp = SHOURU_XINXI[j].month1;
        SHOURU_XINXI[j].month1 = SHOURU_XINXI[where].month1;
        SHOURU_XINXI[where].month1 = temp;

        temp = SHOURU_XINXI[j].ri1;
        SHOURU_XINXI[j].ri1 = SHOURU_XINXI[where].ri1;
        SHOURU_XINXI[where].ri1 = temp;

        temp = SHOURU_XINXI[j].hour1;
        SHOURU_XINXI[j].hour1 = SHOURU_XINXI[where].hour1;
        SHOURU_XINXI[where].hour1 = temp;

        temp = SHOURU_XINXI[j].minute1;
        SHOURU_XINXI[j].minute1 = SHOURU_XINXI[where].minute1;
        SHOURU_XINXI[where].minute1 = temp;

        temp = SHOURU_XINXI[j].money1;
        SHOURU_XINXI[j].money1 = SHOURU_XINXI[where].money1;
        SHOURU_XINXI[where].money1 = temp;

        strncpy(tempThing, SHOURU_XINXI[j].thing1, 101);
        strncpy(SHOURU_XINXI[j].thing1, SHOURU_XINXI[where].thing1, 101);
        strncpy(SHOURU_XINXI[where].thing1, tempThing, 101);
    }

    for (j = expenseCount - 1; j >= 1; j--)
    {
        tempYear = ZHICHU_XINXI[0].year2;
        tempMonth = ZHICHU_XINXI[0].month2;
        tempDay = ZHICHU_XINXI[0].ri2;
        tempHour = ZHICHU_XINXI[0].hour2;
        tempMinute = ZHICHU_XINXI[0].minute2;
        where = 0;
        for (i = 1; i <= j; i++)
        {
            if (tempYear < ZHICHU_XINXI[i].year2 ||
                (tempYear == ZHICHU_XINXI[i].year2 && tempMonth < ZHICHU_XINXI[i].month2) ||
                (tempYear == ZHICHU_XINXI[i].year2 && tempMonth == ZHICHU_XINXI[i].month2 && tempDay < ZHICHU_XINXI[i].ri2) ||
                (tempYear == ZHICHU_XINXI[i].year2 && tempMonth == ZHICHU_XINXI[i].month2 && tempDay == ZHICHU_XINXI[i].ri2 && tempHour < ZHICHU_XINXI[i].hour2) ||
                (tempYear == ZHICHU_XINXI[i].year2 && tempMonth == ZHICHU_XINXI[i].month2 && tempDay == ZHICHU_XINXI[i].ri2 && tempHour == ZHICHU_XINXI[i].hour2 && tempMinute < ZHICHU_XINXI[i].minute2))
            {
                tempYear = ZHICHU_XINXI[i].year2;
                tempMonth = ZHICHU_XINXI[i].month2;
                tempDay = ZHICHU_XINXI[i].ri2;
                tempHour = ZHICHU_XINXI[i].hour2;
                tempMinute = ZHICHU_XINXI[i].minute2;
                where = i;
            }
        }
        temp = ZHICHU_XINXI[j].year2;
        ZHICHU_XINXI[j].year2 = ZHICHU_XINXI[where].year2;
        ZHICHU_XINXI[where].year2 = temp;

        temp = ZHICHU_XINXI[j].month2;
        ZHICHU_XINXI[j].month2 = ZHICHU_XINXI[where].month2;
        ZHICHU_XINXI[where].month2 = temp;

        temp = ZHICHU_XINXI[j].ri2;
        ZHICHU_XINXI[j].ri2 = ZHICHU_XINXI[where].ri2;
        ZHICHU_XINXI[where].ri2 = temp;

        temp = ZHICHU_XINXI[j].hour2;
        ZHICHU_XINXI[j].hour2 = ZHICHU_XINXI[where].hour2;
        ZHICHU_XINXI[where].hour2 = temp;

        temp = ZHICHU_XINXI[j].minute2;
        ZHICHU_XINXI[j].minute2 = ZHICHU_XINXI[where].minute2;
        ZHICHU_XINXI[where].minute2 = temp;

        temp = ZHICHU_XINXI[j].money2;
        ZHICHU_XINXI[j].money2 = ZHICHU_XINXI[where].money2;
        ZHICHU_XINXI[where].money2 = temp;

        strncpy(tempThing, ZHICHU_XINXI[j].thing2, 101);
        strncpy(ZHICHU_XINXI[j].thing2, ZHICHU_XINXI[where].thing2, 101);
        strncpy(ZHICHU_XINXI[where].thing2, tempThing, 101);
    }

    for (j = totalCount - 1; j >= 1; j--)
    {
        tempYear = ZONG_XINXI[0].year3;
        tempMonth = ZONG_XINXI[0].month3;
        tempDay = ZONG_XINXI[0].ri3;
        tempHour = ZONG_XINXI[0].hour3;
        tempMinute = ZONG_XINXI[0].minute3;
        where = 0;
        for (i = 1; i <= j; i++)
        {
            if (tempYear < ZONG_XINXI[i].year3 ||
                (tempYear == ZONG_XINXI[i].year3 && tempMonth < ZONG_XINXI[i].month3) ||
                (tempYear == ZONG_XINXI[i].year3 && tempMonth == ZONG_XINXI[i].month3 && tempDay < ZONG_XINXI[i].ri3) ||
                (tempYear == ZONG_XINXI[i].year3 && tempMonth == ZONG_XINXI[i].month3 && tempDay == ZONG_XINXI[i].ri3 && tempHour < ZONG_XINXI[i].hour3) ||
                (tempYear == ZONG_XINXI[i].year3 && tempMonth == ZONG_XINXI[i].month3 && tempDay == ZONG_XINXI[i].ri3 && tempHour == ZONG_XINXI[i].hour3 && tempMinute < ZONG_XINXI[i].minute3))
            {
                tempYear = ZONG_XINXI[i].year3;
                tempMonth = ZONG_XINXI[i].month3;
                tempDay = ZONG_XINXI[i].ri3;
                tempHour = ZONG_XINXI[i].hour3;
                tempMinute = ZONG_XINXI[i].minute3;
                where = i;
            }
        }
        temp = ZONG_XINXI[j].year3;
        ZONG_XINXI[j].year3 = ZONG_XINXI[where].year3;
        ZONG_XINXI[where].year3 = temp;

        temp = ZONG_XINXI[j].month3;
        ZONG_XINXI[j].month3 = ZONG_XINXI[where].month3;
        ZONG_XINXI[where].month3 = temp;

        temp = ZONG_XINXI[j].ri3;
        ZONG_XINXI[j].ri3 = ZONG_XINXI[where].ri3;
        ZONG_XINXI[where].ri3 = temp;

        temp = ZONG_XINXI[j].hour3;
        ZONG_XINXI[j].hour3 = ZONG_XINXI[where].hour3;
        ZONG_XINXI[where].hour3 = temp;

        temp = ZONG_XINXI[j].minute3;
        ZONG_XINXI[j].minute3 = ZONG_XINXI[where].minute3;
        ZONG_XINXI[where].minute3 = temp;

        temp = ZONG_XINXI[j].money3;
        ZONG_XINXI[j].money3 = ZONG_XINXI[where].money3;
        ZONG_XINXI[where].money3 = temp;

        temp = ZONG_XINXI[j].leixing3;
        ZONG_XINXI[j].leixing3 = ZONG_XINXI[where].leixing3;
        ZONG_XINXI[where].leixing3 = temp;

        strncpy(tempThing, ZONG_XINXI[j].thing3, 101);
        strncpy(ZONG_XINXI[j].thing3, ZONG_XINXI[where].thing3, 101);
        strncpy(ZONG_XINXI[where].thing3, tempThing, 101);
    }
}
